blob: 1e47791807a6b6afd65b06ebe6eaa1f7238436dc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { fail, redirect } from "@sveltejs/kit";
import { fd, auth, post } from "$lib/utils";
export async function load({ parent }) {
const { user } = await parent();
if (!user) redirect(307, "/register");
}
export const actions = {
default: async ({ cookies, request }) => {
const body = await fd(request);
try {
await post("/take", body, auth(cookies));
} catch (e: any) {
return fail(400, { message: e.message });
}
redirect(307, `/fund/${body.id}`);
},
};
|